<div class="header-search">
    <!-- <input type="text" class="txtsearch" name="txtsearch" id="txtsearch"
     placeholder="enter any value!" [(ngModel)]="searchtext" (input)="search()" />
    &nbsp;&nbsp;
    <button [ngClass]="{'btnsearch':searchtext,'btnsearch-disabled':!searchtext}"  
    [disabled]="searchtext==''?true:false" (click)="search()">Search</button>    -->

    <!-- 模版引用变量 #searchinput-->
    <!-- <input type="text" class="txtsearch" name="txtsearch" id="txtsearch"
     placeholder="enter any value!" [(ngModel)]="searchtext"
     (input)="search(searchinput)" #searchinput />
    &nbsp;&nbsp;
    <button [ngClass]="{'btnsearch':searchtext,'btnsearch-disabled':!searchtext}"  
    [disabled]="searchtext==''?true:false" (click)="search(searchinput )">Search</button>  -->

    <!-- Angular中的ViewChild -->
    <input type="text" class="txtsearch" name="txtsearch" id="txtsearch"
     placeholder="enter any value!" [(ngModel)]="searchtext"
     (input)="search()" #searchinput />
    &nbsp;&nbsp;
    <button [ngClass]="{'btnsearch':searchtext,'btnsearch-disabled':!searchtext}"  
    [disabled]="searchtext==''?true:false" (click)="search()">Search</button>

</div>
<div class="divresult" *ngIf="searchtext!==''">
    <span>查询关键字:{{ searchtext }}</span>
</div>
 